<!DOCTYPE html>
<html>
<head>
    <meta name="layout" content="main"/>
    <g:set var="entityName" value="${message(code: 'estate.label', default: 'estate')}"/>
    <title>逾期情况报表</title>
    <style>
    .table>tbody>tr>td{
        vertical-align: middle;
    }
    </style>
</head>

<body class="fixed-navbar fixed-sidebar">
<div class="small-header">
    <div class="hpanel">
        <div class="panel-body">
            <div id="hbreadcrumb" class="pull-right">
                <ol class="hbreadcrumb breadcrumb">
                    <li>CINDATA PLS</li>
                    <li class="active">
                        <span>逾期情况报表</span>
                    </li>
                </ol>
            </div>

            <h2 class="font-light m-b-xs">
                %{--<i id="goBack" class="pe-7s-back fa-2x" style="position: absolute; top: 8px;" ></i>--}%
                <span>逾期情况报表</span>
            </h2>
        </div>
    </div>
</div>
<div class="content animate-panel">
    <div class="row">
        <g:form method="POST" action="overdueSituationReport" class="form-horizontal" role="form"  >
            <div class="hpanel hblue">
                <div class="panel-heading">
                    <div class="panel-tools">
                        <button class="btn btn-primary btn-xs" type="submit"><i class="fa fa-search"></i>查询</button>
                        <button class="btn btn-warning2 btn-xs" type="button" id="resetBtn">
                            <i class="fa fa-times"></i>重置</button>
                    </div>
                    查询
                </div>
                <div class="panel-body seach-group" id="bug1">
        %{--第一行--}%
            <div class="row">
                <div class="form-group col-sm-4">
                    <label for="serialNumber" class="col-sm-3 control-label">贷款编号</label>
                    <div class="col-sm-9">
                        <input type="text" class=" form-control " placeholder="贷款编号"
                               id="serialNumber" value="${params?.serialNumber}" name="serialNumber" />
                    </div>
                </div>
                <div class="form-group col-sm-4">
                    <label for="sourceAddress" class="col-sm-3 control-label">押品地址</label>
                    <div class="col-sm-9">
                        <input type="text" class=" form-control " placeholder="押品地址"
                               id="sourceAddress" value="${params?.sourceAddress}" name="sourceAddress" />

                    </div>
                </div>

                <div class="form-group col-sm-4">
                    <label for="jigou" class="col-sm-3 control-label">担保机构</label>
                    <div class="col-sm-9">
                        <g:select class="form-control" name="jigou" id="jigou"
                                  from="${com.cindata.Account.findAllByType(com.cindata.dictionary.AccountTypeDict.GUARANTOR())}"
                                  valueMessagePrefix="status" optionKey="id" optionValue="name"
                                  value="${params?.jigou}"
                                  noSelection="${["-1": '请选择机构']}"/>
                    </div>
                </div>

            </div>
        %{--第二行--}%
            <div class="row">
                <div class="form-group col-sm-4">
                    <label for="startDateStart" class="col-sm-3 control-label">逾期日期</label>
                    <div class="col-sm-9 input-daterange input-group p-r-n"  id="datepicker" style="width: 75%;">
                        <input type="text" class=" form-control " placeholder="请选择开始时间"
                               value="${params?.startDateStart}" name="startDateStart" id="startDateStart" />
                        <span class="input-group-addon">to</span>
                        <input type="text" class=" form-control " placeholder="请选择结束时间"
                               value="${params?.startDateEnd}" name="startDateEnd" id="startDateEnd" />
                    </div>
                </div>

                <div class="form-group col-sm-4">
                    <label for="method" class="col-sm-3 control-label">担保方式</label>
                    <div class="col-sm-9">
                        <g:select class="form-control" name="method" id="method"
                                  from="${com.cindata.dictionary.GuaranteeMethodDict.list()}"
                                  valueMessagePrefix="status" optionKey="id" optionValue="name"
                                  value="${params?.method}"
                                  noSelection="${["-1": '请选择担保方式']}"/>
                    </div>
                </div>

            </div>
            </div>
        </g:form>
    </div>
    </div>
    <div class="row">
        <div class="hpanel hgreen">
            <div class="panel-heading">
                <div class="panel-tools">
                    <g:link   action="overdueSituationReportExportExcel" class="btn btn-info btn-xs"   params="${params}"
                              data-target="_target"><i class="glyphicon glyphicon-download-alt"></i></g:link>
                    <a class="showhide"><i class="fa fa-chevron-up"></i></a>
                </div>
                &nbsp;
            </div>
            <div class="panel-body ">
                <div class="table-responsive">
                    <table cellpadding="1" cellspacing="1" class=" table table-striped table-hover" id="esateTable">
                        <thead>
                        <tr>
                            <g:sortableColumn property="serialNumber" title="贷款编号"  class="col-md-1 text-center" params="${params}"/>
                            <g:sortableColumn property="loanMethod" title="放款日期" class="col-md-1 text-center" params="${params}"/>
                            <g:sortableColumn property="sourceAddress" title="押品地址" class="col-md-1 text-center" params="${params}"/>
                            <g:sortableColumn property="practicalRepaymentCapital" title="本金金额(元)" class="col-md-1 text-center" params="${params}"/>
                            <g:sortableColumn property="practicalRepaymentInterest" title="利息金额(元)" class=" col-md-1 text-center" params="${params}"/>
                            <g:sortableColumn property="fineAmount" title="罚息金额(元)" class="col-md-1 text-center" params="${params}"/>
                            <g:sortableColumn property="overdueDate" title="逾期日期" class=" col-md-1 text-center" params="${params}"/>
                            <g:sortableColumn property="overdueState" title="逾期状态" class="col-md-1 text-center" params="${params}"/>
                            <g:sortableColumn property="repaymentDate" title="还逾期日期" class="col-md-1 text-center" params="${params}"/>
                            <g:sortableColumn property="guaranteeInstitution" title="担保机构" class=" col-md-1 text-center" params="${params}"/>
                            <g:sortableColumn property="guaranteeMethod" title="担保方式" class=" col-md-1 text-center" params="${params}"/>
                        </tr>
                        </thead>
                        <tbody>
                        <g:each in="${estateList}">
                            <tr>
                                <td class="text-center">${it?.mortgage?.serialNumber}</td>
                                <td class="text-center"> <g:formatDate date="${it?.mortgage.startDate}" format="yyyy-MM-dd "></g:formatDate></td>
                                <td class="text-center">${it?.mortgage?.collateral?.estate?.sourceAddress}</td>
                                <td class="text-center">${it?.practicalRepaymentCapital}</td>
                                <td class="text-center">${it?.practicalRepaymentInterest}</td>
                                <td class="text-center">${it?.fineAmount}</td>
                                <td class="text-center"> <g:formatDate date="${it?.overdueDate}" format="yyyy-MM-dd "></g:formatDate></td>
                                <td class="text-center">${it?.overdueState?.name}</td>
                                <td class="text-center"> <g:formatDate date="${it?.repaymentDate}" format="yyyy-MM-dd "></g:formatDate></td>
                                <td class="text-center">${it?.mortgage?.guaranteeInstitution?.name}</td>
                                <td class="text-center">${it?.mortgage?.guaranteeMethod?.name}</td>
                            </tr>
                        </g:each>
                        </tbody>
                    </table>
                </div>
            </div>
            <div class="panel-footer">
                <div class="pagination">
                    <g:paginate total="${estateCount ?: 0}"  params="${params}" action="overdueSituationReport"/>
                </div>
            </div>
        </div>
    </div>
</div>
<g:javascript>
    $(function () {

        $('#datepicker').datepicker({
            language: 'zh-CN'
        });
        $("#datepicker").on("changeDate", function(event) {
            $("#my_hidden_input").val(
                    $("#datepicker").datepicker('getFormattedDate')
            )
        });

        $('.input-group.date').datepicker({ });
        $('.input-daterange').datepicker({ });
    });
    //重置按钮
    $("#resetBtn").click(function () {
        $("#select2-chosen-1:first").html("请选择机构");
        $("#select2-chosen-2:first").html("请选择担保方式");
        $("#serialNumber").val("");
        $("#sourceAddress").val("");
        $("#startDateEnd").val("");
        $("#startDateStart").val("");
    })

    $(function(){
        $('#goBack').click(function(){
            window.history.back(-1);
        })
    })
</g:javascript>

</body>
</html>